import vue from '@vitejs/plugin-vue';
import createUnoCss from './unocss';
import createAutoImport from './auto-import';
import createComponents from './components';
import createIcons from './icons';
import createSvgIconsPlugin from './svg-icon';
import createCompression from './compression';
import createVueSetupExtend from './vue-setup-extend';
import createMonacoEditor from './monaco-editor';
import purgeIcons from 'vite-plugin-purge-icons';
import { configStyleImportPlugin } from './styleImport';

import path from 'path';

export default (viteEnv: any, isBuild = false): [] => {
    const vitePlugins: any = [];
    vitePlugins.push(vue());
    vitePlugins.push(createMonacoEditor);
    vitePlugins.push(createUnoCss());
    vitePlugins.push(createAutoImport(path));
    vitePlugins.push(createComponents(path));
    vitePlugins.push(createCompression(viteEnv));
    vitePlugins.push(createIcons());
    vitePlugins.push(createSvgIconsPlugin(path, isBuild));
    vitePlugins.push(createVueSetupExtend());
    vitePlugins.push(purgeIcons());
    // vite-plugin-style-import
    vitePlugins.push(configStyleImportPlugin(isBuild));

    return vitePlugins;
};
